package com.eeds.common.model;


import com.eeds.common.constant.ParametersConstants;
import com.eeds.common.enums.DeviceType;
import com.eeds.common.enums.LoginType;
import com.eeds.servlet.HttpServletUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

/**
 * @author revelin
 * @date 下午4:53 18-2-6
 **/
@ApiModel("id")
@Slf4j
public class ReqUserId extends ReqLanguageInfo{


	@ApiModelProperty(value="userId", hidden = true)
    @Setter
    private Long userId;



    public Long getUserId(){

		try {
			Object userIdObj = HttpServletUtil.getHttpServletRequest().getAttribute(ParametersConstants.USER_ID);
			if (userIdObj != null) {
				log.error("用户id:" + userIdObj.toString());
				return Long.parseLong(userIdObj.toString());
			} else {
				return this.userId;
			}
		}catch (Exception e){
			return null;
		}

	}


}
